import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class FourthQuestion {
    public static void main(String[] args) {
        int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5};
        int count=0;
        for (int i = 0; i <oldArr.length ; i++) {
            if (oldArr[i]==0){
                continue;
            }
            count++;
        }
        int NewArr[]=new int[count];
         count= 0;
        for (int i = 0; i <oldArr.length ; i++) {
            if (oldArr[i]!=0){
                NewArr[count]=oldArr[i];
                count++;
            }
        }
        for (int newArr:NewArr) {
            System.out.print(newArr+"  ");
        }
    }
}
